package 责任链模式.demo2;

/**
 * 单例模式的狗
 *
 * @author ithuameng
 */
public class DogSingle {

    // 懒汉模式
    private static volatile Dog dogSingle = null;

    private DogSingle() {}

    public static Dog getInstance() {
        if (null == dogSingle) {
            synchronized(DogSingle.class) {
                if (null == dogSingle) {
                    dogSingle = new BigDog(3, new MiddleDog(2, new LittleDog(1, null)));
                }
            }
        }
        return dogSingle;
    }
}
